Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt to check against core routes before loading all app routes #24295

Merged
merged 1 commit into from
Jun 2, 2021

Conversation

juliusknorr
Copy link
Member

Most of the time we will find a matching route in either the loaded ones
matched on the URL or in the core ones. Therfore we can attempt to try
those first and only load all app routes if no match was found by the
Symfony URLMatcher.

This improves the loading times of all routes that do not match the checks to load only required routes /apps/, /ocsapp/apps/, /settings/ or /core/, mostly the core routes that do not start with core like unified search, svg, css, login to mention some of them.

https://blackfire.io/profiles/compare/4c47d56e-5311-4acc-883a-176b8f7c374f/graph
https://blackfire.io/profiles/compare/6df20296-dc75-43a6-8629-22d530805fb7/graph

core/routes.php Outdated
['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'],
['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
['name' => 'Svg#getSvgFromCore', 'url' => '/core/svg/core/{folder}/{fileName}', 'verb' => 'GET'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not be needed, but those should be safe to change and it feels a bit cleaner to have them properly prefixed, so that one knows where they are located.

Copy link
Member

@MorrisJobke MorrisJobke Nov 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some apps use this:

Bildschirmfoto 2020-11-23 um 16 08 37

Bildschirmfoto 2020-11-23 um 16 08 28

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely the same for the others. Maybe we register the old URLs as well for a grace period and notify the maintainers of those apps about the change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's actually skip this change for now, since this was mainly my starting point, but I figured that it was suitable to just check core routes first if we don't match the a known route prefix like /apps/.

Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@rullzer rullzer mentioned this pull request Dec 14, 2020
59 tasks
@rullzer rullzer mentioned this pull request Dec 18, 2020
39 tasks
@rullzer rullzer modified the milestones: Nextcloud 21, Nextcloud 22 Dec 22, 2020
@rullzer
Copy link
Member

rullzer commented Dec 22, 2020

Let us do this for 22 early in the cycle so we catch potential issues.

This was referenced May 20, 2021
@blizzz blizzz mentioned this pull request Jun 2, 2021
57 tasks
Most of the time we will find a matching route in either the loaded ones
matched on the URL or in the core ones. Therfore we can attempt to try
those first and only load all app routes if no match was found by the
Symfony URLMatcher.

Signed-off-by: Julius Härtl <[email protected]>
@blizzz
Copy link
Member

blizzz commented Jun 2, 2021

failing test is unrelated and fixed in master

@blizzz blizzz merged commit aa40bde into master Jun 2, 2021
@blizzz blizzz deleted the perf/noid/router branch June 2, 2021 19:03
@MorrisJobke MorrisJobke mentioned this pull request Jun 10, 2021
59 tasks
@PVince81
Copy link
Member

this causes a regression in the Talk app using the autocomplete API: https://github.com/nextcloud/spreed/issues/5887

hard to tell why

if (!\OC::$server->getConfig()->getSystemValueBool('maintenance') && !Util::needUpgrade()) {
\OC_App::loadApps();
}
$this->loadRoutes('core');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just loading the core routes here seems instead of all routes causes the guests app to be loaded too late so the AppConfigOverwrite is not yet registered when the DI is assembling the arguments for the autocomplete controller 🙈

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this is due to https://github.com/nextcloud/guests/blob/eb7eb7c1b31e751bbbcc7671e5e1997b82297d45/appinfo/routes.php#L22-L26 where I'm not sure why the late setup would be needed here. A quick test for moving that to app.php seems to fix the issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to proceed, then ? I don't have enough core knowledge to be able to evaluate whether your proposed change is safe to fix nextcloud/guests#654

@PVince81
Copy link
Member

revert PR here #27715 for a short term quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants